package com.liqi.display.utils;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class DateUtil {

    /**
     * 每天的统计
     * 时间设为当天的0时0分0秒开始查询
     *
     * @Return
     */
    public static Date getDay() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date day = calendar.getTime();
        return day;
    }

    /**
     * 每天的上班时间
     * 上班时间设定为 0时0分0秒 开始查询
     * @return
     */
    public static Date getOnDutyTime() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date day = calendar.getTime();
        return day;
    }

    /**
     * 每天的下班时间
     * 下班时间设定为 次日0时0分0秒 结束查询
     * @return
     */
    public static Date getOffDutyTime() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DATE, +1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date day = calendar.getTime();
        return day;
    }

    /**
     * 获取当前月的一号零时零分零秒开始
     *
     * @return
     */
    public static Date getMonth() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date month = calendar.getTime();
        return month;
    }

    /**
     * 获取当前年的一月一号零时零分零秒开始
     *
     * @return
     */
    public static Date getYear() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.MONTH, 0);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date year = calendar.getTime();
        return year;
    }

    /**
     * 获取昨天的零时零分零秒开始
     *
     * @return
     */
    public static Date getYesterday() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DATE, -1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date yesterday = calendar.getTime();
        return yesterday;
    }

    /**
     * 当前时间
     *
     * @return
     */
    public static Date getCurrentDay() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        Date currentDay = calendar.getTime();
        return currentDay;
    }

    /**
     * 昨天当前时间
     *
     * @return
     */
    public static Date getYesterdayCurrent() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DATE, -1);
        Date yesterdayCurrent = calendar.getTime();
        return yesterdayCurrent;
    }

    /**
     * 获取上月的当前时间
     *
     * @return
     */
    public static Date getBeforeMonthCurrent() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.MONTH, -1);
        return calendar.getTime();
    }

    /**
     * 获取上一月的1号零时零分零秒
     *
     * @return
     */
    public static Date getBeforeMonthFirst() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.MONTH, -1);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        return calendar.getTime();
    }

    /**
     * 获取上一年的当前时间
     *
     * @return
     */
    public static Date getBeforeYear() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.YEAR, -1);
        return calendar.getTime();
    }

    /**
     * 获取上一年的一月一日零时零分零秒
     */
    public static Date getBeforeYearFirst() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.YEAR, -1);
        calendar.set(Calendar.MONTH, 0);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        return calendar.getTime();
    }


    /**
     * 时间转字符串
     *
     * @param date    时间
     * @param pattern 格式化类型，默认为yyyy-MM-dd HH:mm:ss，其它使用DateUtils.xxx
     * @return
     */
    public static String format(Date date, String pattern) {
        if (date == null) {
            return "";
        } else {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
            return simpleDateFormat.format(date);
        }
    }

    /**
     * 获取固定时间菜单
     *
     * @return
     */
    public static List<String> getTimeData() {
        //当前需要显示的时间菜单
        List<String> dateMenus = new ArrayList<String>();
        dateMenus.add("9:00~10:00");
        dateMenus.add("10:00~11:00");
        dateMenus.add("11:00~12:00");
        dateMenus.add("12:00~13:00");
        dateMenus.add("13:00~14:00");
        dateMenus.add("14:00~15:00");
        dateMenus.add("15:00~16:00");
        dateMenus.add("16:00~17:00");
        dateMenus.add("17:00~18:00");
        return dateMenus;
    }

    /**
     * 获取固定月数据
     *
     * @return
     */
    public static List<String> getMonthData() {
        //当前需要显示的时间菜单
        List<String> monthMenus = new ArrayList<String>();
        monthMenus.add("1");
        monthMenus.add("2");
        monthMenus.add("3");
        monthMenus.add("4");
        monthMenus.add("5");
        monthMenus.add("6");
        monthMenus.add("7");
        monthMenus.add("8");
        monthMenus.add("9");
        monthMenus.add("10");
        monthMenus.add("11");
        monthMenus.add("12");
        return monthMenus;
    }


    /**
     * 获取当前时间小时整点时间
     *
     * @param
     * @return
     */
    public static Date getCurrentHourTime() {
        return getHourTime(new Date(), 0, "=");
    }

    /**
     * 获取指定时间上n个小时整点时间
     *
     * @param date
     * @return
     */
    public static Date getLastHourTime(Date date, int n) {
        return getHourTime(date, n, "-");
    }

    /**
     * 获取指定时间下n个小时整点时间
     *
     * @param date
     * @return
     */
    public static Date getNextHourTime(Date date, int n) {
        return getHourTime(date, n, "+");
    }

    /**
     * 获取指定时间n个小时整点时间
     *
     * @param date
     * @return
     */
    public static Date getHourTime(Date date, int n, String direction) {
        Calendar ca = Calendar.getInstance();
        ca.setTime(date);
        ca.set(Calendar.MINUTE, 0);
        ca.set(Calendar.SECOND, 0);
        switch (direction) {
            case "+":
                ca.set(Calendar.HOUR_OF_DAY, ca.get(Calendar.HOUR_OF_DAY) + n);
                break;
            case "-":
                ca.set(Calendar.HOUR_OF_DAY, ca.get(Calendar.HOUR_OF_DAY) - n);
                break;
            case "=":
                ca.set(Calendar.HOUR_OF_DAY, ca.get(Calendar.HOUR_OF_DAY));
                break;
            default:
                ca.set(Calendar.HOUR_OF_DAY, ca.get(Calendar.HOUR_OF_DAY));
        }

        date = ca.getTime();
        return date;
    }

    public static int getMonthNum() {
        Calendar cal = Calendar.getInstance();
        int month = cal.get(Calendar.MONTH) + 1;
        return month;
    }

    public static String getStrYesterday() {
        Date today = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
        return simpleDateFormat.format(today);//获取昨天日期
    }

    /*
    获取上一年数据
     */
    public static int getPreYear() {
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR) - 1;
        return year;
    }

    /*
   获取当年数据
    */
    public static int getCurYear() {
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        return year;
    }

    /**
     * 获取最近的日期
     *
     * @param num 7天，30天
     * @return
     */
    public static Date getLateDate(String pattern, int num) {
        try {
            Calendar now = Calendar.getInstance();
            now.add(Calendar.DAY_OF_MONTH, -num);
            String endDate = new SimpleDateFormat(pattern).format(now.getTime());
            Date date = new SimpleDateFormat(pattern).parse(endDate);
            return date;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /**
     * 获取最近日期可设置时分秒，如果为空则不设置
     *
     * @param pattern
     * @return
     */
    public static Date getLate(String pattern, int num, Integer hour, Integer minute, Integer second) {
        try {
            Calendar now = Calendar.getInstance();
            now.add(Calendar.DAY_OF_MONTH, -num);
            if (hour != null) {
                now.set(Calendar.HOUR_OF_DAY, hour);
            }
            if (minute != null) {
                now.set(Calendar.MINUTE, minute);
            }
            if (second != null) {
                now.set(Calendar.SECOND, second);
            }
//            String endDate = new SimpleDateFormat(pattern).format(now.getTime());
//            Date date = new SimpleDateFormat(pattern).parse(endDate);
            Date date = now.getTime();
            return date;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /**
     * 获取最近日期的工作日时间
     *
     * @param num
     * @param hour
     * @param minute
     * @param second
     * @return
     */
    public static Date getLateWorkDay(int num, Integer hour, Integer minute, Integer second) {
        try {
            Calendar now = Calendar.getInstance();
            now.add(Calendar.DAY_OF_MONTH, -num);
            if (hour != null) {
                now.set(Calendar.HOUR_OF_DAY, hour);
            }
            if (minute != null) {
                now.set(Calendar.MINUTE, minute);
            }
            if (second != null) {
                now.set(Calendar.SECOND, second);
            }
            if (isWork(new SimpleDateFormat("yyyy-MM-dd").format(now.getTime()))) {
                Date date = now.getTime();
                return date;
            }

            if (!isWork(new SimpleDateFormat("yyyy-MM-dd").format(now.getTime()))) {
                return null;
            }
            Date date = now.getTime();
            return date;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /**
     * 判断时间是否在2021/8/15号之前得日期
     * 开厅之前的日期不要
     */
    public static Date getlaterStart(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        if (calendar.get(Calendar.YEAR) >= 2021 && calendar.get(Calendar.MONTH) > 7) {
            return date;
        } else if (calendar.get(Calendar.YEAR) >= 2021 && calendar.get(Calendar.MONTH) == 7 && calendar.get(Calendar.DAY_OF_MONTH) >= 15) {
            return date;
        } else {
            if (calendar.get(Calendar.YEAR) < 2021) {
                calendar.set(Calendar.YEAR, 2021);
            }
            if (calendar.get(Calendar.MONTH) <= 7) {
                calendar.set(Calendar.MONTH, 7);
                calendar.set(Calendar.DAY_OF_MONTH, 16);
            }

            Date time = calendar.getTime();
            return time;
        }

    }

    /**
     * 获取两个日期间有多少个非工作日
     */
    public static int getNotWorkDay(int num) {
        ConcurrentHashMap<String, Integer> map = new ConcurrentHashMap();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        int max = 0;
        int workDay = 0;
        boolean flag = true;
        for (int i = num; i >= 1; i--) {
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DAY_OF_MONTH, -i);
            Date time = calendar.getTime();
            if (!isWork(format.format(time))) {
                max += 1;
            } else {
                workDay += 1;
            }
        }
        if (workDay == num) {
            flag = false;
        }

        while (flag) {
            for (int s = max + num; s > num; s--) {
                Calendar calendar = Calendar.getInstance();
                calendar.add(Calendar.DAY_OF_MONTH, -s);
                Date time = calendar.getTime();
                if (!isWork(format.format(time))) {
                    if (map.get(format.format(time)) == null) {
                        max += 1;
                        map.put(format.format(time), s);
                    }
                } else {
                    workDay += 1;
                }
                if (workDay == num) {
                    flag = false;
                    return max;
                }
            }
        }
        return max;
    }


    /**
     * 判断当前时间是否为工作日
     */
   /* public static boolean isWork(String date) {
        String url = "http://timor.tech/api/holiday/year/";
        Calendar calendar = Calendar.getInstance();

        OkHttpClient client = new OkHttpClient();
        Response response;
        //解密数据
        String rsa = null;
        Request request = new Request.Builder()
                .url(url)
                .get()
                .addHeader("Content-Type", "application/x-www-form-urlencoded")
                .build();
        try {
            Date date1 = new SimpleDateFormat("yyyy-MM-dd").parse(date);
            calendar.setTime(date1);
            response = client.newCall(request).execute();
            rsa = response.body().string();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Map map = JSONObject.parseObject(rsa, Map.class);
        Map<String, Map<String, Object>> holiday = (Map) map.get("holiday");
        for (String key : holiday.keySet()) {
            if (date.equals(holiday.get(key).get("date")) && (Boolean) holiday.get(key).get("holiday") == true) {
                return false;
            }
            if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
                if (date.equals(holiday.get(key).get("date")) && (Boolean) holiday.get(key).get("holiday") == false) {
                    return true;
                } else {
                    return false;
                }
            }
        }

        return true;
    }*/
    public static boolean isWork(String date) {
        Calendar calendar = Calendar.getInstance();
        try {
            Date date1 = new SimpleDateFormat("yyyy-MM-dd").parse(date);
            calendar.setTime(date1);
            Map map = JSONObject.parseObject(readFile(), Map.class);
            Map<String, Map<String, Object>> holiday = (Map) map.get("holiday");
            boolean isWorkday = true;
            for (String key : holiday.keySet()) {
                if (date.equals(holiday.get(key).get("date")) && (Boolean) holiday.get(key).get("holiday") == true) {
                    isWorkday = false;
                    break;
                }
                if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
                    isWorkday = false;
                    if (date.equals(holiday.get(key).get("date")) && (Boolean) holiday.get(key).get("holiday") == false) {
                        isWorkday = true;
                        break;
                    }
                }
            }
            return isWorkday;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 读去json文件
     *
     * @throws Exception
     */
    public static String readFile() {
        try {
            Resource resource = new ClassPathResource("WorkDay.json");
            InputStream is = resource.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            String data = null;
            while ((data = br.readLine()) != null) {
                return data;
            }
            br.close();
            isr.close();
            is.close();
            return data;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("读取json异常！");
        }

    }


    /**
     * @return 返回近30天工作日
     */
    public static List<String> near30WorkDay() {
        // 读取文件数据
//        byte[] bytes;
//        try {
//            File file = org.springframework.util.ResourceUtils.getFile("classpath:WorkDay.json");
//            bytes = Files.readAllBytes(file.toPath());
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new RuntimeException("读取json文件异常！");
//        }
//        String text = new String(bytes, StandardCharsets.UTF_8);
        String text = readFile();
        JSONObject jsonObject = JSONObject.parseObject(text);
        JSONObject holiday = jsonObject.getJSONObject("holiday");
        Map<String, Boolean> map = new HashMap<>();
        for (int i = 0; i < holiday.size(); i++) {
            String date = holiday.getString("date");
            Boolean isHoliday = holiday.getBoolean("holiday");
            map.put(date, isHoliday);
        }

        // 计算工作日
        List<String> list = new ArrayList<>(30);
        LocalDate now = LocalDate.now();
        while (list.size() < 30) {
            now = now.plusDays(-1L);
            Boolean b = map.get(now.toString());

            if (b != null) {
                // 调班日
                if (!b) {
                    list.add(now.toString());
                    continue;
                }
                // 休假日
                if (b) {
                    continue;
                }
            }

            int week = now.getDayOfWeek().getValue();
            // 周末
            if (week == 6 || week == 7) {
                continue;
            }
            // 工作日
            list.add(now.toString());
        }
        // 反转
        Collections.reverse(list);

        return list;
    }

    /**
     * @return 返回近7天工作日
     */
    public static List<String> near7WorkDay() {
        // 读取文件数据
//        byte[] bytes;
//        try {
//            File file = org.springframework.util.ResourceUtils.getFile("classpath:WorkDay.json");
//            bytes = Files.readAllBytes(file.toPath());
//        } catch (Exception e) {
//            throw new RuntimeException("读取json文件异常！");
//        }
//        String text = new String(bytes, StandardCharsets.UTF_8);
        String text = readFile();
        JSONObject jsonObject = JSONObject.parseObject(text);
        JSONObject holiday = jsonObject.getJSONObject("holiday");
        Map<String, Boolean> map = new HashMap<>();
        for (int i = 0; i < holiday.size(); i++) {
            String date = holiday.getString("date");
            Boolean isHoliday = holiday.getBoolean("holiday");
            map.put(date, isHoliday);
        }

        // 计算工作日
        List<String> list = new ArrayList<>(7);
        LocalDate now = LocalDate.now();
        while (list.size() < 7) {
            now = now.plusDays(-1L);
            Boolean b = map.get(now.toString());

            if (b != null) {
                // 调班日
                if (!b) {
                    list.add(now.toString());
                    continue;
                }
                // 休假日
                if (b) {
                    continue;
                }
            }

            int week = now.getDayOfWeek().getValue();
            // 周末
            if (week == 6 || week == 7) {
                continue;
            }
            // 工作日
            list.add(now.toString());


        }
        // 反转
        Collections.reverse(list);

        return list;
    }

    /**
     * @return 返回30天前的今天
     */
    public static Date near30Day() {
        Date today = getDay();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(today);
        calendar.add(Calendar.DATE, -30);
        Date lastmonthToday = calendar.getTime();
        return lastmonthToday;
    }

    /**
     * 返回7天前的今天
     * @return
     */
    public static Date near7Day() {
        Date today = getDay();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(today);
        calendar.add(Calendar.DATE, -7);
        Date lastweekToday = calendar.getTime();
        return lastweekToday;
    }

    /**
     * @return 返回近7天，包含周末和节假日
     */
    public static List<String> getSevenDate() {
        Date today = getYesterday();
        List<String> dateList = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        for (int i = 0; i < 7; i++) {

            Date date = DateUtils.addDays(today, -i);
            String formatDate = sdf.format(date);
            dateList.add(formatDate);
        }
        return dateList;
    }

    public static void main(String[] args) throws Exception {
        Date today = getYesterday();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        for (int i = 0; i < 7; i++) {

            Date date = DateUtils.addDays(today, -i);
            String formatDate = sdf.format(date);
            System.out.println(formatDate);
        }


    }

    /**
     * @return 返回近30天，包含周末和节假日
     */
    public static List<String> getThirtyDate() {

        List<String> dateList = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        for (int i = 0; i < 30; i++) {

            Date date = DateUtils.addDays(new Date(), -i);
            String formatDate = sdf.format(date);
            dateList.add(formatDate);
        }
        return dateList;
    }

    /**
     * 获取每个月的第一天
     * @param month
     * @return
     */
    public static Date getMonthFirstDay(Integer month) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.MONTH, month);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        return calendar.getTime();
    }

    /**
     * 获取每个月的最后一天
     * @param month
     * @return
     */
    public static Date getMonthLastDay(Integer month) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.MONTH, month);
        calendar.set(Calendar.DAY_OF_MONTH, 0);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        return calendar.getTime();
    }

    /**
     * 获取某年某月的最后一天
     *
     */
    public static String getLastDayOfYearMonth(int year,int month)
    {
        Calendar cal = Calendar.getInstance();
        //设置年份
        cal.set(Calendar.YEAR,year);
        //设置月份
        cal.set(Calendar.MONTH, month);
        //获取当月最小值
        int lastDay = cal.getMinimum(Calendar.DAY_OF_MONTH);
        //设置日历中的月份，当月+1月-1天=当月最后一天
        cal.set(Calendar.DAY_OF_MONTH, lastDay-1);
        //格式化日期
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String lastDayOfMonth = sdf.format(cal.getTime());
        return lastDayOfMonth;
    }

    /**
     * 获取最近12个月（包含当月）
     * @return months
     */
    public static List<String> getLast12Months() {
        List<String> months = new ArrayList<>();
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)+1); //要先+1,才能把本月的算进去
        // 加此行,否则3月重复
        cal.set(Calendar.DATE,1);
        for(int i=0; i<12; i++) {
            cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) - 1); //逐次往前推1个月
            months.add(cal.get(Calendar.YEAR) + "-" + fromatMonth((cal.get(Calendar.MONTH) + 1)));
        }
        return months;
    }

    /**
     * 月份需要加0 则调用此方法
     */
    public static  String fromatMonth(Integer month){
        return month<10 ?  "0"+month : ""+ month;
    }

}
